package com.loop.practice1;

public class Test {
    public void add(int... nums){
        int sum = 0;
        for (int i = 0; i <nums.length ; i++) {
            sum += nums[i];
        }
        System.out.println("和为"+sum);
    }

    public static void main(String[] args) {
        Test t = new Test();
        t.add(1,2,3,4,5,6);
    }
}
